<template>
    <div class="contain-box">
        <div class="box-header">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>资金管理</el-breadcrumb-item>
                <el-breadcrumb-item to="/paymentOrder" replace>付款单</el-breadcrumb-item>
                <el-breadcrumb-item>付款单详情</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="box-body">
            <div class="body-top">付款单详情</div>
            <div class="body-set">
                <el-input disabled v-model="addObj.name" placeholder="供应商名称" style="width: 200px;margin-right: 10px"
                          size="small"></el-input>
                <el-date-picker
                        disabled
                        v-model="addObj.moneyTime"
                        size="small"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="付款日期">
                </el-date-picker>
            </div>

            <div class="body-table">
                <el-table
                        :data="addObj.purchaseOrderList"
                        size="small"
                        border
                        style="width: 100%">
                    <el-table-column
                            type="index"
                            label="序号"
                            width="100px"
                            align="center"
                    >
                    </el-table-column>
                    <el-table-column
                            prop="orderNum"
                            label="关联采购订单"
                            align="center"
                    >
                    </el-table-column>
                    <el-table-column
                            label="应付款金额(元)"
                            align="center"
                    >
                        <template slot-scope="scope">
                            {{scope.row.discountMoney+scope.row.actualPay}}
                        </template>
                    </el-table-column>
                    <el-table-column
                            prop="discountMoney"
                            label="优惠金额(元)"
                            align="center"
                    >
                    </el-table-column>
                    <el-table-column
                            prop="actualPay"
                            label="实付金额(元)"
                            align="center"
                    >
                    </el-table-column>
                    <el-table-column
                            prop="settlement.settlementName"
                            label="结算方式"
                            align="center"
                    >
                    </el-table-column>


                </el-table>
            </div>
            <div style="margin-top: 20px;display: flex;justify-content: flex-start">
                <p style="font-size: 16px">付款凭证 :</p>
                <el-link @click="dowmLoad" type="info">下载</el-link>
            </div>
            <div class="body-set">
                <el-input disabled v-model="addObj.remarks" placeholder="请输入收款备注" type="textarea" style="width: 50%" :rows="5"
                          resize="none"
                          size="small"></el-input>
            </div>

        </div>
        <div class="box-submit">
            <div class="submit-left">
                <p>总计金额: <span>￥{{addObj.totalMoney}}</span></p>
                <p>实收金额: <span>￥{{addObj.actualMoney}}</span></p>
            </div>
            <div>
                <el-button @click="goBack" type="primary" size="small" style="background-color: #1abc9c">返 回
                </el-button>
            </div>
        </div>
    </div>
</template>

<script>
    import common from "../utils/common";

    export default {
        data() {
            return {
                tableData: [],
                addObj: {
                    moneyTime: null,
                    salesOrderId: [],
                    certificateUrl: null,
                    type: 2,
                    remarks: null,
                    name: null,
                    totalMoney: 0,
                    actualMoney: 0,
                    purchaseOrderList:[]
                },
            }
        },
        created() {
            this.findById(this.$route.query.id)
        },
        methods: {
            dowmLoad(){
                window.open(this.addObj.certificateUrl,"_blank")
            },
            findById(id){
                this.axios.get('/collectPayOrder/findById?id='+id).then(res=>{
                    if(res.data.code===200){
                        this.addObj = res.data.data
                    }
                })
            },
            goBack() {
                this.$router.go(-1)
            },

        }
    }
</script>

<style scoped lang="less">
    .contain-box {
        width: 100%;
        height: 100%;

        /deep/ .distpicker-address-wrapper {
            select {
                width: 32% !important;
                padding: 0px 10px !important;
                height: 35px !important;
                font-size: 12px !important;
                line-height: 35px !important;
                border-radius: 5px;
            }
        }

        .dialog-box {
            width: 100%;
        }

        .dialog-page {
            margin-top: 20px;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: flex-end;

            /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
                background-color: #1abc9c;
            }
        }

        /deep/ .el-dialog__body {
            padding: 10px 20px;
        }

        .box-header {
            width: 100%;
            height: 50px;
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .box-body {
            width: 100%;
            border-radius: 5px;
            padding: 20px;
            box-sizing: border-box;
            box-shadow: 0 0 5px 0 #e4e4e4;

            .body-top {
                width: 100%;
                height: 50px;
                text-align: center;
                line-height: 50px;
                border-bottom: 1px solid #e4e4e4;
                font-size: 20px;
                color: #666;
            }

            .body-set {
                margin-top: 20px;
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: flex-start;
            }

            .body-add {
                margin-top: 20px;
                width: 100%;
            }

            .body-table {
                margin-top: 20px;
                width: 100%;
            }

            .body-message {
                margin-top: 20px;
                width: 100%;

                .message-box {
                    margin-top: 20px;
                    display: flex;
                    align-items: center;
                    cursor: pointer;

                    .message-img {
                        margin-left: 20px;
                        width: 20px;
                        height: 20px;
                    }

                    .message-son {
                        margin-right: 15px;
                        font-size: 14px;
                    }
                }
            }
        }

        .box-submit {
            margin-top: 20px;
            width: 100%;
            border-radius: 5px;
            padding: 20px;
            box-sizing: border-box;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-shadow: 0 0 5px 0 #e4e4e4;

            .submit-left {
                display: flex;
                font-size: 16px;

                p {
                    margin-right: 20px;

                    span {
                        color: red;
                        font-weight: bold;
                    }
                }
            }
        }
    }
</style>
